package javaweb_work01.classesContrl.Dao;

import javaweb_work01.login.Utils.DruidUtils;
import org.apache.commons.dbutils.QueryRunner;

import java.sql.SQLException;

public class DelClassesDaoImp implements DelClassesDao{

    /**
     * 访问数据库实现删除指定班级的功能
     * @param cid
     */
    @Override
    public void delClasses(int cid) {
        try {
            //使用连接池创建QueryRunner对象
            QueryRunner qr = new QueryRunner(DruidUtils.getDataSource());
            //编写sql语句
            String sql = "delete from class where cid = ?";
            //执行语句
            qr.update(sql,cid);
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
